//
//  MPBNetWoringHeader.h
//  Pods
//
//  Created by jiaxuzhou on 2017/6/7.
//
//

#ifndef MPBNetWoringSettings_h
#define MPBNetWoringSettings_h


/**
 网络请求中一些默认值和枚举
 */
#import <Foundation/Foundation.h>


/// response对象类型
typedef NS_ENUM(NSUInteger, MPE_NetResponseType)
{
    /// json
    MPE_NetResponseType_Json = 0,
    
    /// data  主要用于请求的数据不是json结构
    MPE_NetResponseType_Data
};

/// 秒拍暂时用不到，还没有采用section过期机制
typedef NS_ENUM(NSInteger, MPE_NetWorkSessionState)
{
    /// session过期后弹登陆框，登录成功回调
    MPE_NetWorkSessionState_Login_Success = 0,
};

/// 网络请求结果状态
typedef NS_ENUM(NSInteger, MPE_NetWorkState)
{
    /// 网络请求结果 成功
    MPE_NetWorkState_Successs = 0,
    
    /// 网络请求结果 失败
    MPE_NetWorkState_Fail,
    
    /// 网络请求没有返回值  session过期
    MPE_NetWorkState_NoBack
};

/// 网路请求方式 POST GET
typedef NS_ENUM(NSUInteger, MPE_NetMethod)
{
    /// 普通 POST 请求，默认方法
    MPE_POST,
    
    /// 普通 GET 请求
    MPE_GET
};

/// 网络优先级
typedef NS_ENUM(NSInteger, MPE_NetWorkPriority)
{
    MPE_NetWorkPriority_Default = 0,
    
    MPE_NetWorkPriority_Low,
    
    MPE_NetWorkPriorityHigh,
};

/// response加密方式
typedef NS_ENUM(NSInteger, MPE_NetRespSecType)
{
    /// 老的json加密
    MPE_NetRespSecType_JsonOld = 0,
    /// json
    MPE_NetRespSecType_Json = 1,
    /// msgpack
    MPE_NetRespSecType_Msgpack,
    /// 自定义json加密
    MPE_NetRespSecType_CustomJsonSec,
    /// 自定义特殊加密
    MPE_NetRespSecType_CustomSpecialSec
};

#define MPDNetWorkPriority(proirity) proirity == MPE_NetWorkPriority_Default?(NSURLSessionTaskPriorityDefault):(proirity == MPE_NetWorkPriority_Low?NSURLSessionTaskPriorityLow:NSURLSessionTaskPriorityHigh)

/// 默认是否展示错误toast
#define MPDefautShowToastState NO

/// 默认是否展示无网络提示
#define MPDefautShowNoNetViewState YES

/// 默认参数是否加密
#define MPDefautIsEncrypt NO

/// 默认超时时间
#define MPDefaultRequestTimeoutInterval 60.f

/// 默认优先级
#define MPDefaultRequestPriority MPE_NetWorkPriority_Default

/// MPBNetWorkBase子类，用于自定义参数公共参数等逻辑
#define MPDNetWorkBaseGetSubClassSel @"getNeedReplaceClassByCategory"

/// MPBNetWorking子类，用于MPMNetRequestModel发送请求特殊处理
#define MPDNetWorkingGetSubClassSel @"getNeedReplaceSessionManagerClassByCategory"

/// 去除respondsToSelector 警告
#define SuppressPerformSelectorLeakWarning(Stuff) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
Stuff; \
_Pragma("clang diagnostic pop") \
} while (0)



#endif /* MPBNetWoringSettings_h */
